﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="modificarMatricula.aspx.cs" Inherits="sistemaAcademicoFinanceiroEscolasProgre.Insert" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Cadastrar Progressão</title>
    <link href="Site2.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            font-style: normal;
            color: #000000;
            text-decoration: none;
            width: 83%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <br />
    
      <table width="300px" border="0">
       <tr>
        <td width="3%"><img src="../../../images/setadireita.gif" width="16" height="14" /></td>
        <td class="style1">Nome</td>
        <td width="14%"><asp:Label CssClass="style1" ID="lblAlunoNome" runat="server" 
                Text=""></asp:Label></td>
      </tr>
       <tr>
        <td width="3%"><img src="../../../images/setadireita.gif" width="16" height="14" /></td>
        <td class="style1">Serie</td>
        <td width="14%"><asp:Label CssClass="style1" ID="lblAlunoSerie" runat="server" 
                Text=""></asp:Label></td>
      </tr>
      <tr>
      <td width="3%"><img src="../../../images/setadireita.gif" width="16" height="14" /></td>
        <td class="style1">Ano Letivo</td>
        
        <td width="14%"><asp:Label CssClass="style1" ID="lblAlunoAno" runat="server" 
                Text=""></asp:Label></td>
        
      </tr><tr>
        <td colspan="5%"><img src="../images/linhaDivPops.gif" width="250" height="8" /></td>
      </tr>
      
     
     
        
         <% 
          
      //loop das disciplinas da serie em progressão

       string codigoSerie = "";
          
      System.Data.SqlClient.SqlConnection sqlc = new System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings["baseDados"]);
      sqlc.Open();
       
     
             
      
      string sqlProg = "select * from matricula where codigoMatricula =" + Request["codigoMatricula"].ToString();
                  System.Data.SqlClient.SqlCommand cmdDisci = new System.Data.SqlClient.SqlCommand(sqlProg, sqlc);
                  System.Data.SqlClient.SqlDataReader myReaderDisci = cmdDisci.ExecuteReader();



                  while (myReaderDisci.Read())
                  {
                      codigoSerie = myReaderDisci["codigoSerie"].ToString();






                      cmdDisci.Dispose();




                      System.Data.SqlClient.SqlConnection sqlc2 = new System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings["baseDados"]);
                      sqlc2.Open();



                      //Verifica se a disciplina esta cadastrada na serie    

                      string sqlDisciplina = "select * from disciplina where codigoSerie=" + codigoSerie;

                      System.Data.SqlClient.SqlCommand cmdProfessorDisciplina = new System.Data.SqlClient.SqlCommand(sqlDisciplina, sqlc2);
                      System.Data.SqlClient.SqlDataReader myReaderProfessorDisciplina = cmdProfessorDisciplina.ExecuteReader();
                      while (myReaderProfessorDisciplina.Read())
                      {
                          CheckBox dis = new CheckBox();
                          dis.ID = myReaderProfessorDisciplina["codigoDisciplina"].ToString();
                          dis.Text = myReaderProfessorDisciplina["descricaoDisciplina"].ToString();
                      
                
                
      %>
      
      
      <tr>
        <td width="2%"><img src="../images/setadireita.gif" width="16" height="14" /></td>
        <td class="style1"><%Response.Write(myReaderProfessorDisciplina["descricaoDisciplina"].ToString()); %></td>
        <td width="17%">
        
        <%if (myReaderDisci.HasRows)
          {
        %>
        
        <input type="checkbox" name="<%Response.Write(myReaderProfessorDisciplina["codigoDisciplina"].ToString()); %>" checked />
        
        <%
             }
          else
          { 
        %>
        <input type="checkbox" name="<%Response.Write(myReaderProfessorDisciplina["codigoDisciplina"].ToString()); %>" />
        <% 
             }
                      }
                      cmdProfessorDisciplina.Dispose();
                      myReaderProfessorDisciplina.Close();
                      
                  }
          myReaderDisci.Close();

        %>
            
        
        
        
        </td>
      </tr>
        
      
    </table>        
    <asp:Panel ID="Panel1" runat="server">
        <asp:HiddenField ID="codigoAluno" runat="server" />
    
    </asp:Panel> 
     
    <br />
    
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
            Text="Salvar" />
   
   </form>
</body>
</html>